#!/usr/bin/env python
# coding=utf-8
"""
# @Created on : 2016/05/02 12:36
# @Author     : ldf (ldf@eehello.com)
# @Link       : http://www.eehello.com
# @Version    : 
# 本程序在python2.7下测试通过
"""

import socket

ip_port = ('127.0.0.1',8888)
sk = socket.socket()
sk.bind(ip_port)
sk.listen(5)

flag = 1

while flag:
    conn01, addr01 = sk.accept()
    print 'conn01: %s , addr= %s' % (conn01,addr01)
    a = conn01.sendall('hello')
    print 'a: %s' % a
    data01 = conn01.recv(1024)
    print 'data01: %s' % data01
    if data01 == 'exit':
        flag = 0

conn01.close()